<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>{$current['title']}-{$Think.CONFIG.sitename}</title>

    <link href="__PUBLIC__/static/css/bootstrap.min.css?v=3.3.5" rel="stylesheet">
    <link href="__PUBLIC__/static/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="__PUBLIC__/static/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
    <link href="__PUBLIC__/static/css/animate.min.css" rel="stylesheet">
    <include file="Public/commoncss" />
    <!-- Sweet Alert -->
    <link href="__PUBLIC__/static/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">

</head>

<body class="gray-bg top-navigation">
<div id="wrapper">
    <div id="page-wrapper" class="gray-bg">
        <div class="row border-bottom white-bg">
            <include file="Public/header" />
        </div>
        <div class="wrapper wrapper-content">
            <div class="row">
                <div class="col-sm-3">
                    <div class="ibox float-e-margins">
                        <include file="Public/deptnav" />
                    </div>
                </div>
                <div class="col-sm-9 animated fadeInRight">
                    <div class="ibox float-e-margins">
                        <div class="ibox-title"><h4>所有用户</h4></div>
                        <div class="ibox-content">

                            <div class="row row-lg">


                                <div class="col-sm-12">
                                    <!-- Example Toolbar -->
                                    <div class="example-wrap">
                                        <!--<h4 class="example-title">工具条</h4>-->
                                        <div class="example">

                                            <div class="bootstrap-table">
                                                <div class="fixed-table-toolbar">
                                                    <div class="bars pull-left">
                                                        <div class="btn-group hidden-xs" id="exampleToolbar" role="group">
                                                            <button type="button" class="btn btn-outline btn-default" onclick="window.location.href='{:U(add)}'">
                                                                <i class="glyphicon glyphicon-plus" aria-hidden="true"></i>
                                                            </button>
                                                            <button type="button" class="btn btn-outline btn-default" data-toggle="modal" data-target="#delModal" id="get-ids">
                                                                <i class="glyphicon glyphicon-trash" aria-hidden="true"></i>
                                                            </button>
                                                        </div>
                                                    </div>
                                                    <form action="{:U('index')}" method="get">
                                                        <div class="columns columns-right btn-group pull-right">
                                                            <button class="btn btn-default btn-outline" type="submit" name="refresh" title="查找">
                                                                <i class="glyphicon glyphicon-search"></i>
                                                            </button>
                                                        </div>
                                                        <div class="pull-right search">
                                                            <input class="form-control input-outline" placeholder="全文搜索" name="keyword" type="text" value="{$_GET['keyword']}">
                                                        </div>
                                                    </form>

                                                </div>
                                                <div class="fixed-table-container" style="padding-bottom: 0px;">
                                                    <div class="fixed-table-body">
                                                        <table id="exampleTableToolbar" data-mobile-responsive="true" class="table table-hover">
                                                            <thead>
                                                            <tr>
                                                                <th style="" data-field="name" tabindex="0">
                                                                    <div class="th-inner ">
                                                                        <input type="checkbox" class="check-all">
                                                                        全选
                                                                    </div>
                                                                    <div class="fht-cell">
                                                                    </div>
                                                                </th>
                                                                <th style="" data-field="star" tabindex="0">
                                                                    <div class="th-inner ">
                                                                       账号
                                                                    </div>
                                                                    <div class="fht-cell">
                                                                    </div>
                                                                </th>
                                                                <th style="" data-field="license" tabindex="0">
                                                                    <div class="th-inner ">
                                                                       成员信息
                                                                    </div>
                                                                    <div class="fht-cell">
                                                                    </div>
                                                                </th>

                                                                <th style="" data-field="license" tabindex="0">
                                                                    <div class="th-inner ">
                                                                        联系方式
                                                                    </div>
                                                                    <div class="fht-cell">
                                                                    </div>
                                                                </th>
                                                                <th style="" data-field="description" tabindex="0">
                                                                    <div class="th-inner ">
                                                                        用户组
                                                                    </div>
                                                                    <div class="fht-cell">
                                                                    </div>
                                                                </th>
                                                                <th style="" data-field="description" tabindex="0">
                                                                    <div class="th-inner ">
                                                                        最后登录时间
                                                                    </div>
                                                                    <div class="fht-cell">
                                                                    </div>
                                                                </th>
                                                                <th style="" data-field="url" tabindex="0">
                                                                    <div class="th-inner ">
                                                                        操作
                                                                    </div>
                                                                    <div class="fht-cell">
                                                                    </div>
                                                                </th>
                                                            </tr>
                                                            </thead>
                                                            <tbody>
                                                            <volist name="list" id="val" empty="没有找到匹配的记录">
                                                                <tr class="no-records-found">
                                                                    <td class="center" style="width: 10px">
                                                                        <if condition="$val['uid'] neq 1">
                                                                            <input class="uids" type="checkbox" name="uids[]" value="{$val['uid']}">
                                                                            <else />
                                                                            <span title="系统管理员，禁止删除">--</span>
                                                                        </if>
                                                                    </td>
                                                                    <td>{$val['user']|SearchWords=$_GET['keyword']}</td>
                                                                    <td class="text-left">
                                                                        <p>姓名：{$val['name']|SearchWords=$_GET['keyword']}</p>
                                                                        <if condition="$val['dept_name']|length gt 8">
                                                                            <p class="many-look" style="cursor:pointer;" val="{$val['dept_name']}">部门：字数超出请点击</p>
                                                                        <else/>
                                                                            <p >部门：{$val['dept_name']|SearchWords=$_GET['keyword']}</p>
                                                                        </if>
                                                                        <p>职位：{$val['rank']|SearchWords=$_GET['keyword']}</p>
                                                                        <p><i class="fa fa-black-tie"></i> {$val['type']|getMemberType|SearchWords=$_GET['keyword']}</p>
                                                                    </td>
                                                                    <td class="text-left">
                                                                        <p>QQ:{$val['qq']|SearchWords=$_GET['keyword']}</p>
                                                                        <p>分机号:{$val['tel']|SearchWords=$_GET['keyword']}</p>
                                                                        <p>Email:{$val['email']|SearchWords=$_GET['keyword']}</p>
                                                                        <p>手机号:{$val['phone']|SearchWords=$_GET['keyword']}</p>
                                                                    </td>
                                                                    <td class="grouptd">

                                                                        <if condition="$val['uid'] neq 1">
                                                                            <span class="group" val="{$val['uid']}">{$val['title']|SearchWords=$_GET['keyword']}</span>
                                                                            <select class="groupselect hide">
                                                                                <volist name="group" id="v">
                                                                                    <option <if condition="$val['gid'] eq $v['id']">selected="selected"</if> value="{$v.id}">{$v.title}</option>
                                                                                </volist>
                                                                            </select>
                                                                            <else/>
                                                                            <span>{$val['title']|SearchWords=$_GET['keyword']}</span>
                                                                        </if>
                                                                    </td>
                                                                    <td class="center" style="width: 130px;">{$val['t']|beenTime}</td>
                                                                    <td class="center">
                                                                        <if condition="$val['uid'] neq $user['uid']">
                                                                            <a href="{:U('edit')}?uid={$val['uid']}">修改</a>&nbsp;
                                                                            <else/>
                                                                            <a href="{:U('Dzone/personal')}">修改</a>&nbsp;
                                                                        </if>
                                                                    </td>
                                                                </tr>
                                                            </volist>

                                                            </tbody>
                                                        </table>
                                                    </div>

                                                </div>
                                            </div>
                                            <div class="clearfix"></div>
                                        </div>
                                    </div>
                                    <!-- End Example Toolbar -->
                                </div>
                                <div class="col-sm-12">
                                    <!-- Example Pagination -->
                                    <div class="example-wrap">
                                        <div class="example">
                                            <div class="clearfix">{$page}</div>
                                        </div>
                                    </div>
                                    <!-- End Example Pagination -->
                                </div>

                            </div>


                        </div>
                    </div>

                </div>
            </div>
        </div>
        <!--删除提示模态框-->
        <div class="modal inmodal fade" id="delModal" tabindex="-1" role="dialog"  aria-hidden="true">
            <div class="modal-dialog modal-sm">
                <form action="{:U('del')}" role="form" id="delForm">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                            <h4 class="modal-title">友情提示</h4>
                        </div>
                        <div class="modal-body">
                            <p id="delTips">确定删除这些用户组吗？</p>
                        </div>
                        <div class="modal-footer">
                            <input type="hidden" name="uids" id="del-ids" value="">
                            <button type="button" class="btn btn-white" data-dismiss="modal">让我想想</button>
                            <button type="submit" class="btn btn-danger btn-sm"> 是的！ </button>
                        </div>
                    </div>
                </form>
            </div>
        </div>

        <include file="Public/footer" />
    </div>
</div>
<include file="Public/commonjs" />
<script src="__PUBLIC__/static/js/bootstrap.min.js?v=3.3.5"></script>
<script src="__PUBLIC__/static/js/content.min.js?v=1.0.0"></script>
<script src="__PUBLIC__/static/js/plugins/bootstrap-table/bootstrap-table.min.js"></script>
<script src="__PUBLIC__/static/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script>
<script src="__PUBLIC__/static/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
<script src="__PUBLIC__/static/js/demo/bootstrap-table-demo.min.js"></script>
<script src="__PUBLIC__/static/js/plugins/validate/Validform_v5.3.2.js"></script>
<script src="__PUBLIC__/static/js/plugins/sweetalert/sweetalert.min.js"></script>
<script>
    $(function(){
        $(".group").click(function(){
            $(this).addClass('hide');
            $(this).parent().find(".groupselect").removeClass('hide');
        })
        $(".groupselect").on("change",function(){
            var ob = $(this);
            var gid=ob.val();
            var uid = ob.parent().find('.group').attr('val');
            $.get("{:U('update')}?ajax=yes&uid="+uid+"&gid="+gid,function(data){
                var text = ob.find("option:selected").text();
                ob.parent().find(".group").removeClass('hide').html(text);
                ob.addClass('hide');
            });
        })

        //查看隐藏文字
        $(".many-look").click(function(){
            swal('所在部门',$(this).attr("val"));
        });

        $(".check-all").click(function(){
            $(".uids").prop("checked", this.checked);
        });
        $(".uids").click(function(){
            var option = $(".ids");
            option.each(function(i){
                if(!this.checked){
                    $(".check-all").prop("checked", false);
                    return false;
                }else{
                    $(".check-all").prop("checked", true);
                }
            });
        });

        //获取uids的json数组
        $("#get-ids").click(function(){
            var data = getJson('uids[]');
            $("#del-ids").val(data);
        })

        //删除
        $("#delForm").Validform({
            tiptype:function(msg,o,cssctl){
                if(!o.obj.is("form")){
                    var objtip=o.obj.find("#delTips");
                    cssctl(objtip,o.type);
                    objtip.text(msg);
                }else{
                    if(msg == '恭喜,操作成功！'){
                        window.location.reload();
                    }else{
                        var objtip=o.obj.find("#delTips");
                        cssctl(objtip,o.type);
                        objtip.text(msg);
                    }
                }
            },
            ajaxPost:true
        });



    })

</script>
</body>

</html>